﻿using GGGK.Film.Models.Dto;
using GGGK.Film.Models.Models;

namespace GGGK.Film.Api.Automapper
{
    public class PO2DTOMappingProfile:AutoMapper.Profile
    {
        public PO2DTOMappingProfile()
        {
            CreateMap<Base_UserInfo, UserInfoDto>()
                .ForMember(d => d.LoginName, s => s.MapFrom(p => p.Base_LoginInfos.FirstOrDefault().LoginName))
                .ForMember(d => d.LoginCount, s => s.MapFrom(p => p.Base_LoginInfos.FirstOrDefault().LoginCount))
                .ForMember(d => d.LoginLastTime, s => s.MapFrom(p => p.Base_LoginInfos.FirstOrDefault().LoginLastTime))
                .ReverseMap();

            CreateMap<Base_RoleInfo, RoleInfoDto>().ReverseMap();
        }
    }
}
